package
{
	import flash.display.Shape;
	
	public class Asteroid extends Shape
	{
		private static var points:Array = [
			[-10,-5],
			[-10,5],
			[-5,10],
			[5,10],
			[10,5],
			[10,-5],
			[5,-10],
			[-5,-10]
		];
		
		public function Asteroid(scale:Number = 1)
		{
			// Set the line style to a 1-unit white line
			this.graphics.lineStyle(1,0xFFFFFF);			

			// Start drawing at the first point
			this.graphics.moveTo(points[0][0]*scale, points[0][1]*scale);		
			
			// Draw the points, skip the first point
			for (var i:int = 1; i < points.length; i++)
			{
				this.graphics.lineTo(scale*(points[i][0] + Math.random()*10-5), scale*(points[i][1] + Math.random()*10-5));
			}
			
			// Draw the final point
			this.graphics.lineTo(points[0][0]*scale, points[0][1]*scale);
		}

	}
}